//
//  HomeController.m
//  万物记
//
//  Created by Ajen on 2019/6/14.
//  Copyright © 2019 Ajen. All rights reserved.
//

#import "HomeController.h"
#import "HomeTopTabView.h"
#import "TouchMoveSingleView.h"
#import "MoreRespondView.h"
#import "MoreController.h"
#import "HomeContentController.h"
#import "AddNewRespondView.h"
#import "AddContentController.h"
#import "NewChangeNicknameAlertView.h"
#import "TableViewGapRespondView.h"
#import "SearchController.h"

#import "DYAdAlertView.h"
#import "DYAdModel.h"

@interface HomeController ()<DYAdAlertDelegate>{
    UIView * tabLeftRespondView;//选项卡左面响应区域视图
    UIView * tabRightRespondView;//选项卡右面响应区域视图

    dispatch_source_t tabMoveLeftTimer;
    dispatch_source_t tabMoveRightTimer;
    UIImpactFeedbackGenerator *feedBackGenertor;
    
    MoreRespondView * moreRespondView;
    AddNewRespondView * addNewRespondView;
    
    NSMutableArray<TableViewGapRespondView *> * tableViewGapViewMuArray;//列表缝隙响应区域视图的容器
    NSInteger moveInGapIndex;//悬浮球当前所在的缝隙视图下标
}
@property(nonatomic)HomeTopTabView * tabView;
@property(nonatomic)TouchMoveSingleView * touchView;
@property(nonatomic)HomeContentController * childController;

@end

@implementation HomeController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    self.navigationController.navigationBar.hidden = YES;
    moveInGapIndex = -1;
    
    [LocalModel shared].model = [LocalJsonModel mj_objectWithKeyValues:[[NSUserDefaults standardUserDefaults] objectForKey:@"LocalJsonDic"]];
    
    AJLog(@"%@",[LocalModel shared].model.mj_JSONString);
    
    AJLog(@"%@",[LocalModel shared].titlesArray);
    
    feedBackGenertor = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium];
    
    
    UILabel * titleLabel = [UILabel new];
    titleLabel.aj_Text(@"万物记").aj_textColorHexStr(@"#2d2e36").aj_addToView(self.view);
    titleLabel.font = SongKeFont(30);
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view).offset(20);
        make.top.equalTo(self.view).offset(STATUS_BAR_HEIGHT);
        make.height.equalTo(@44);
    }];
    
    UILabel * titleLabel2 = [UILabel new];
    titleLabel2.aj_Text(@"记住你的Anything~").aj_textColorHexStr(@"#7a7374").aj_addToView(self.view);
    titleLabel2.font = SongKeFont(15);
    [titleLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(titleLabel.mas_right).offset(15);
        make.bottom.equalTo(titleLabel).offset(-8);
    }];
    
    self.view.aj_bgColorHexStr(@"#ffffff");
    
    
    UIButton * searchButton = [UIButton buttonWithType:UIButtonTypeCustom];
    searchButton.aj_buttonImgName(@"搜索").aj_addTargetSelector(self,@selector(searchButtonDown)).aj_addToView(self.view);
    [searchButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.view).offset(-20);
        make.bottom.equalTo(titleLabel);
        make.width.height.equalTo(@33);
    }];
    
    
    AJLog(@"%@",tabMoveLeftTimer);
    
    
    self.tabView = [HomeTopTabView new];
    [self.view addSubview:self.tabView];
    [self.tabView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view)/*.offset(50)*/;
        make.right.equalTo(self.view)/*.offset(-50)*/;
        make.top.equalTo(titleLabel.mas_bottom);
        make.height.equalTo(@35);
    }];
    self.tabView.titleArray = [LocalModel shared].titlesArray;
    
    
    self.tabView.insertBlock = ^(NSInteger insertToindex) {
        NewChangeNicknameAlertView * changeNickNameView = [NewChangeNicknameAlertView new];
        [[UIApplication sharedApplication].keyWindow addSubview:changeNickNameView];
        [changeNickNameView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo([UIApplication sharedApplication].keyWindow);
        }];
        [UIView animateWithDuration:0.3 animations:^{
            changeNickNameView.backgroundColor = [UIColor colorWithAjenHex:0x000000 alpha:0.5];
        }];
        
        changeNickNameView.commitBlock = ^(NSString * _Nonnull nickName) {
            [[LocalModel shared] addTabWithTitle:nickName andIndex:insertToindex];
            AJLog(@"%@",[LocalModel shared].titlesArray);
    
            self.tabView.titleArray = [LocalModel shared].titlesArray;
            self.tabView.selectedIndex = insertToindex;
            self.childController.homeTitleArray = self.tabView.titleArray;
            self.childController.titleSelectedIndex = insertToindex;
        };
        
        changeNickNameView.alertStr = @"请输入要增加的栏目名(15字以内)";
    };
    
    self.tabView.renameIndexBlock = ^(NSInteger renameIndex) {
        NewChangeNicknameAlertView * changeNickNameView = [NewChangeNicknameAlertView new];
        changeNickNameView.normalNickName = self.tabView.titleArray[renameIndex];
        [[UIApplication sharedApplication].keyWindow addSubview:changeNickNameView];
        [changeNickNameView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo([UIApplication sharedApplication].keyWindow);
        }];
        [UIView animateWithDuration:0.3 animations:^{
            changeNickNameView.backgroundColor = [UIColor colorWithAjenHex:0x000000 alpha:0.5];
        }];
        
        changeNickNameView.commitBlock = ^(NSString * _Nonnull nickName) {
            [[LocalModel shared] renameTabWithTitle:nickName andCurrentIndex:renameIndex];
            AJLog(@"%@",[LocalModel shared].titlesArray);
            self.tabView.titleArray = [LocalModel shared].titlesArray;
            self.tabView.selectedIndex = renameIndex;
            self.childController.homeTitleArray = self.tabView.titleArray;
            self.childController.titleSelectedIndex = renameIndex;
        };
        
        changeNickNameView.alertStr = @"修改栏目名(15字以内)";
    };
    
    tabLeftRespondView = [UIView new];
    //tabLeftRespondView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.view addSubview:tabLeftRespondView];
    //tabLeftRespondView.alpha = 0.5;
    [tabLeftRespondView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view);
        make.top.bottom.equalTo(self.tabView);
        make.width.equalTo(@60);
    }];
    
    tabRightRespondView = [UIView new];
    //tabRightRespondView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.view addSubview:tabRightRespondView];
    //tabRightRespondView.alpha = 0.5;
    [tabRightRespondView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.view);
        make.top.bottom.equalTo(self.tabView);
        make.width.equalTo(@60);
    }];
    
    self.tabView.respondView  = [UIView new];
    //self.tabView.respondView.backgroundColor = [UIColor greenColor];
    [self.view addSubview:self.tabView.respondView];
    //self.tabView.respondView.alpha = 0.3;
    [self.tabView.respondView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(tabLeftRespondView.mas_right).offset(5);
        make.right.equalTo(tabRightRespondView.mas_left).offset(-5);
        make.top.bottom.equalTo(self.tabView);
    }];
    
    //将Tab左右的响应区域视图隐藏,防止阻挡下一层手指左右滑动响应
    tabLeftRespondView.hidden = YES;
    tabRightRespondView.hidden = YES;
    self.tabView.respondView.hidden = YES;
    
    
    //右下角悬浮球
    self.touchView = [[TouchMoveSingleView alloc] initWithFrame:CGRectMake(10, 10, 10, 10) superView:self.view];
    [self.view addSubview:self.touchView];
    [self.touchView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view.mas_bottom).offset(-self.view.Height * 0.35 + 50);
        make.right.equalTo(self.view).offset(-20);
        make.width.height.mas_equalTo(@50);
    }];
    
    //悬浮球松手
    self.touchView.moveEndBlock = ^(CGPoint endPoint) {
        tabLeftRespondView.hidden = YES;
        tabRightRespondView.hidden = YES;
        self.tabView.respondView.hidden = YES;
        moreRespondView.hidden = YES;
        addNewRespondView.hidden = YES;
        [self endTabMoveToLeft];
        [self endTabMoveToRight];
        [self endMoveToMoreView];
        [self endMoveToAddNewView];
        self.tabView.touchEndPoint = endPoint;
        
    
        
        
        if(CGRectContainsPoint(moreRespondView.frame, endPoint)){
            MoreController * moreController = [MoreController new];
            [self.navigationController pushViewController:moreController animated:YES];
        }else if(CGRectContainsPoint(addNewRespondView.frame, endPoint)){
            AddContentController * addContentController = [AddContentController new];
            addContentController.tabIndex = self.childController.titleSelectedIndex;
            addContentController.successBlock = ^{
                [self.childController reload];
            };
            [self.navigationController pushViewController:addContentController animated:YES];
        }else{
            
            for(int i = 0 ; i < tableViewGapViewMuArray.count ; i ++){
                CGRect frame = tableViewGapViewMuArray[i].frame;
                if(CGRectContainsPoint(CGRectMake(0, frame.origin.y - 15, frame.size.width + 10, frame.size.height + 30), endPoint)){
                    
                    AddContentController * addContentController = [AddContentController new];
                    addContentController.tabIndex = self.childController.titleSelectedIndex;
                    addContentController.insertItemIndex = tableViewGapViewMuArray[i].tag - 300000;//插入下标
                    addContentController.successBlock = ^{
                        [self.childController reload];
                    };
                    [self.navigationController pushViewController:addContentController animated:YES];
                }
            }
            
        }
        
        [self hideTableViewGapViews];
        
    };
    
    [tabLeftRespondView.superview layoutIfNeeded];
    [tabRightRespondView.superview layoutIfNeeded];
    
    
    [self addChildViewController:self.childController];
    [self.view addSubview:self.childController.view];
    [self.childController.view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.right.equalTo(self.view);
        make.top.equalTo(self.tabView.mas_bottom);
    }];
    [self.childController.view.superview layoutIfNeeded];
    self.childController.scrollContentHeight = self.childController.view.Height;
    self.childController.homeTitleArray = self.tabView.titleArray;
    
    CGFloat widthMore = ((2.4/6.3) * self.view.Width) * 2;
    moreRespondView = [MoreRespondView new];
    moreRespondView.aj_cornerRadius(widthMore/2).aj_addToView(self.view);
    [moreRespondView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.equalTo(@(widthMore));
        make.centerX.equalTo(self.view.mas_left);
        make.centerY.equalTo(self.view.mas_bottom);
    }];
    moreRespondView.backgroundColor = [UIColor colorWithAjenHex:0x2d2e36 alpha:0.8];
    moreRespondView.hidden = YES;
    
    //
    CGFloat width = ((2.4/6.3) * self.view.Width) * 2;
    addNewRespondView = [AddNewRespondView new];
    addNewRespondView.aj_cornerRadius(width/2).aj_addToView(self.view);
    [addNewRespondView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.equalTo(@(width));
        make.centerX.equalTo(self.view.mas_right);
        make.centerY.equalTo(self.view.mas_bottom);
    }];
    addNewRespondView.backgroundColor = [UIColor colorWithAjenHex:0xf9c116 alpha:0.8];
    addNewRespondView.hidden = YES;
    
    [self.view layoutIfNeeded];
    self.touchView.moveChangeBlock = ^(CGPoint changePoint) {
        
        [self.childController.currentTableView setContentOffset:self.childController.currentTableView.contentOffset animated:NO];
        [self.childController.currentTableView resignFirstResponder];
        
        if(moreRespondView.hidden){
            moreRespondView.hidden = NO;
            moreRespondView.alpha = 0 ;
            [UIView animateWithDuration:0.3 animations:^{
                moreRespondView.alpha = 1 ;
            }];
        }
        if(addNewRespondView.hidden){
            addNewRespondView.hidden = NO;
            addNewRespondView.alpha = 0 ;
            [UIView animateWithDuration:0.3 animations:^{
                addNewRespondView.alpha = 1 ;
            }];
        }
        
        [self showTableViewGapViews];
        
        
        
        tabLeftRespondView.hidden = NO;
        tabRightRespondView.hidden = NO;
        self.tabView.respondView.hidden = NO;
        if(CGRectContainsPoint(tabLeftRespondView.frame, changePoint)){
            [self.tabView moveToOut];
            [self endTabMoveToRight];
            [self endMoveToMoreView];
            [self endMoveToAddNewView];
            [self endMoveToGapView];
            
            [self startTabMoveToLeft];
        }else if(CGRectContainsPoint(tabRightRespondView.frame, changePoint)){
            [self.tabView moveToOut];
            [self endTabMoveToLeft];
            [self endMoveToMoreView];
            [self endMoveToAddNewView];
            [self endMoveToGapView];
            
            [self startTabMoveToRight];
        }else if(CGRectContainsPoint(self.tabView.respondView.frame, changePoint)){
            [self endTabMoveToLeft];
            [self endTabMoveToRight];
            [self endMoveToMoreView];
            [self endMoveToAddNewView];
            [self endMoveToGapView];
            
            self.tabView.touchMovedPoint = changePoint;
        }else if(CGRectContainsPoint(moreRespondView.frame, changePoint)){
            [self.tabView moveToOut];
            [self endTabMoveToLeft];
            [self endTabMoveToRight];
            [self endMoveToAddNewView];
            [self endMoveToGapView];
            
            [self startMoveToMoreView];
        }else if(CGRectContainsPoint(addNewRespondView.frame, changePoint)){
            [self.tabView moveToOut];
            [self endTabMoveToLeft];
            [self endTabMoveToRight];
            [self endMoveToMoreView];
            [self endMoveToGapView];
            
            [self startMoveToAddNewView];
        }else{
            BOOL isInTableViewGapView = NO;
            
            for(int i = 0 ; i < tableViewGapViewMuArray.count ; i ++){
                CGRect frame = tableViewGapViewMuArray[i].frame;
                if(CGRectContainsPoint(CGRectMake(0, frame.origin.y - 15, frame.size.width + 10, frame.size.height + 30), changePoint)){
                    isInTableViewGapView = YES;
                    moveInGapIndex = i;
                }
            }
            if(isInTableViewGapView == YES){
                [self.tabView moveToOut];
                [self endTabMoveToLeft];
                [self endTabMoveToRight];
                [self endMoveToMoreView];
                [self endMoveToAddNewView];
                
                [self startMoveToGapView];
            }else{
                [self.tabView moveToOut];
                [self endTabMoveToLeft];
                [self endTabMoveToRight];
                [self endMoveToMoreView];
                [self endMoveToAddNewView];
                [self endMoveToGapView];
            }
            
        }
    };
    
    [self.tabView.superview layoutIfNeeded];
    
    
    self.tabView.currentIndexBlock = ^(NSInteger currentIndex) {
        AJLog(@">>>> %ld",currentIndex);
        self.childController.titleSelectedIndex = currentIndex;
    };
    self.childController.scrollIndexBlock = ^(NSInteger scrollIndex) {
        self.tabView.onlyShowIndex = scrollIndex;
        self.childController.titleSelectedIndex = scrollIndex;
    };
    
    [self.view bringSubviewToFront:self.touchView];
 
    [RACObserve(self.childController, isScrollingList)subscribeNext:^(id x) {
        if(self.childController.isScrollingList){
            self.touchView.userInteractionEnabled = NO;
        }else{
            self.touchView.userInteractionEnabled = YES;
        }
    }];
    
    //监听设置里面修改首页栏目
    RACSignal *siganl = [[NSNotificationCenter defaultCenter] rac_addObserverForName:@"REFRESH_HOME_TAB" object:nil];
    [siganl subscribeNext:^(NSNotification *x) {
        self.tabView.titleArray = [LocalModel shared].titlesArray;
        self.tabView.selectedIndex = 0;
        self.childController.homeTitleArray = self.tabView.titleArray;
        self.childController.titleSelectedIndex = 0;
    }];
    
    [searchButton setEnlarge:15];
    
    
    //展示教程
    [self showExplain];
}

-(void)startTabMoveToLeft{
    if(!tabMoveLeftTimer && self.tabView.scrollView.contentOffset.x){
        [feedBackGenertor impactOccurred];//震动反馈
        tabMoveLeftTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(0, 0));
        dispatch_source_set_timer(tabMoveLeftTimer, DISPATCH_TIME_NOW, 0.005 * NSEC_PER_SEC, 0.0 * NSEC_PER_SEC);
        dispatch_source_set_event_handler(tabMoveLeftTimer, ^{
            
            dispatch_async(dispatch_get_main_queue(), ^{
                CGFloat x = self.tabView.scrollView.contentOffset.x;
                CGFloat y = self.tabView.scrollView.contentOffset.y;
                self.tabView.scrollView.contentOffset = CGPointMake(x-=1, y);
                AJLog(@"%f",self.tabView.scrollView.contentOffset.x);
                if(self.tabView.scrollView.contentOffset.x <= 0){
                    [self endTabMoveToLeft];
                }
            });
            
        });
        dispatch_resume(tabMoveLeftTimer);
    }
}
-(void)endTabMoveToLeft{
    if(tabMoveLeftTimer){
        dispatch_source_cancel(tabMoveLeftTimer);
        tabMoveLeftTimer = nil;
        AJLog(@"%@",tabMoveLeftTimer);
    }
}

-(void)startTabMoveToRight{
    if(!tabMoveRightTimer && self.tabView.scrollView.contentSize.width >= self.tabView.scrollView.contentOffset.x + self.tabView.Width){
        [feedBackGenertor impactOccurred];//震动反馈
        tabMoveRightTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(0, 0));
        dispatch_source_set_timer(tabMoveRightTimer, DISPATCH_TIME_NOW, 0.005 * NSEC_PER_SEC, 0.0 * NSEC_PER_SEC);
        dispatch_source_set_event_handler(tabMoveRightTimer, ^{
            
            dispatch_async(dispatch_get_main_queue(), ^{
                CGFloat x = self.tabView.scrollView.contentOffset.x;
                CGFloat y = self.tabView.scrollView.contentOffset.y;
                self.tabView.scrollView.contentOffset = CGPointMake(x+=1, y);
                if(self.tabView.scrollView.contentOffset.x + self.tabView.Width>= self.tabView.scrollView.contentSize.width){
                    [self endTabMoveToRight];
                }
            });
            
        });
        dispatch_resume(tabMoveRightTimer);
    }
}
-(void)endTabMoveToRight{
    if(tabMoveRightTimer){
        dispatch_source_cancel(tabMoveRightTimer);
        tabMoveRightTimer = nil;
        AJLog(@"%@",tabMoveRightTimer);
    }
}

-(void)startMoveToMoreView{
    if(!moreRespondView.remind){
        moreRespondView.remind = YES;
        [feedBackGenertor impactOccurred];//震动反馈
    }
}
-(void)endMoveToMoreView{
    moreRespondView.remind = NO;
}

-(void)startMoveToAddNewView{
    if(!addNewRespondView.remind){
        addNewRespondView.remind = YES;
        [feedBackGenertor impactOccurred];//震动反馈
    }
}
-(void)endMoveToAddNewView{
    addNewRespondView.remind = NO;
}

-(void)startMoveToGapView{
    if(moveInGapIndex>-1 && tableViewGapViewMuArray.count > 0){
        if(!tableViewGapViewMuArray[moveInGapIndex].remind){
            tableViewGapViewMuArray[moveInGapIndex].remind = YES;
            [feedBackGenertor impactOccurred];//震动反馈
        }
    }
}
-(void)endMoveToGapView{
    if(moveInGapIndex>-1 && tableViewGapViewMuArray.count > 0){
        tableViewGapViewMuArray[moveInGapIndex].remind = NO;
    }
    
}


//显示列表缝隙响应区域视图
-(void)showTableViewGapViews{
    if(!tableViewGapViewMuArray){
        self.childController.view.userInteractionEnabled = NO;
        tableViewGapViewMuArray = [NSMutableArray arrayWithCapacity:0];
        for(int i = 0 ; i < [LocalModel shared].model.Anything[self.childController.titleSelectedIndex].contentsList.count ; i++){
            CGRect rectInTableView = [self.childController.currentTableView rectForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0]];
            CGRect rect = [self.childController.currentTableView convertRect:rectInTableView toView:[self.childController.currentTableView superview]];
            
            CGFloat originalCellBottom = rectInTableView.origin.y + rectInTableView.size.height;
            CGFloat cellBottom = rect.origin.y + rect.size.height;
            if(cellBottom > 25 && cellBottom < self.childController.currentTableView.Height - addNewRespondView.Height / 2 - 15){
                
//                AJLog(@"%f  %f",originalCellBottom,cellBottom);
                
                TableViewGapRespondView * view = [[TableViewGapRespondView alloc] initWithFrame:CGRectMake(-3, self.childController.view.Top +  cellBottom - 15, SCREEN_WIDTH / 2, 30)];
                [self.view addSubview:view];
                view.tag = 300000 + originalCellBottom / 100;
                AJLog(@"-------%ld",view.tag);
                [tableViewGapViewMuArray addObject:view];
            }
        }
    }
    
}

//隐藏列表缝隙响应区域视图
-(void)hideTableViewGapViews{
    self.childController.view.userInteractionEnabled = YES;
    for(int i = 0 ; i < tableViewGapViewMuArray.count ; i++){
        [tableViewGapViewMuArray[i] removeFromSuperview];
    }
    [tableViewGapViewMuArray removeAllObjects];
    tableViewGapViewMuArray = nil;
    moveInGapIndex = -1;
    
    if(self.childController.currentTableView.contentOffset.y < 0){
        [self.childController.currentTableView setContentOffset:CGPointMake(0, 0) animated:YES];
    }
    AJLog(@"%f     %f",self.childController.currentTableView.contentOffset.y,self.childController.currentTableView.contentSize.height - self.childController.currentTableView.Height);
    if((self.childController.currentTableView.contentSize.height > self.childController.currentTableView.Height) && (self.childController.currentTableView.contentOffset.y > self.childController.currentTableView.contentSize.height - self.childController.currentTableView.Height )){
        [self.childController.currentTableView setContentOffset:CGPointMake(0, self.childController.currentTableView.contentSize.height - self.childController.currentTableView.Height) animated:YES];
    }
}


-(void)searchButtonDown{
    SearchController * searchController = [SearchController new];
    [self.navigationController pushViewController:searchController animated:YES];
}

-(HomeContentController *)childController{
    if(!_childController){
        _childController = [HomeContentController new];
    }
    return _childController;
}


///展示教程
-(void)showExplain{
    NSUserDefaults * userDefault = [NSUserDefaults standardUserDefaults];
    if(![[userDefault objectForKey:@"IS_SHOW_HOME_EXPLAIN"] isEqualToString:@"YES"]){
        NSArray * imgNameArr = @[@"首页插入新栏目.png",@"栏目重命名.png",@"首页新增内容.png",@"首页插入内容.png",@"调整顺序.png"];
        NSMutableArray *arr = [[NSMutableArray alloc]initWithCapacity:0];
        for (int i = 0; i < imgNameArr.count; i++) {
            DYAdModel *adModel  = [[DYAdModel alloc]init];
            adModel.imgStr      = imgNameArr[i];
            adModel.linkUrl     = @"";
            [arr addObject:adModel];
        }
        [self showGaussianBlur];
        [kWindow addSubview:[DYAdAlertView  showInView:kWindow theDelegate:self theADInfo:arr placeHolderImage:@"首页插入新栏目.png"]];
    }
}
-(void)closeDown{
    [self hideGaussianBlur];
    NSUserDefaults * userDefault = [NSUserDefaults standardUserDefaults];
    [userDefault setObject:@"YES" forKey:@"IS_SHOW_HOME_EXPLAIN"];
}
@end
